<include file="../Public/_header.html" />

<div class="so_main">
	<php>if($type!='edit'){</php>
  		<div class="page_tit">生成代金券</div>
  <php>}else{</php>
  		<include file="../Admin/Tpl/default/Partner/top_box.html" />
  <php>}</php>
  <style>
  	.form2 dl{
  		float: left;
    	width: 50%;
    }
  </style>
  <div class="form2" id="main_area">
  	<form method="post" 
  		<php>if($type!='edit'){</php>
  				action="{:U('/Cashcoupon/doCreateCC')}" 
		  <php>}else{</php>
		  		action="{:U('/Cashcoupon/editCC')}" 
		  <php>}</php>
  				enctype="multipart/form-data">
  	<input name="id" id='id' type="hidden" value="{$cashcoupon.id}">
  		<div class="clear"></div>
   	<dl class="lineD" style="font-weight:bold;height:30px;">
      <dt>基本信息：</dt>
				<dd>
				</dd>
    </dl>
    <dl class="lineD" style="height:30px;">
				<dt style="color:red;">是否生效：</dt>
				<dd style="margin-top: 0px;">
					<span>
						<input name="enable" type="checkbox" 
									<eq name="cashcoupon['enable']" value="Y">checked = "checked"</eq>
									value="Y">
						钩选为生效
					</span>
				</dd>
		</dl>
    
    <dl class="lineD">
      <dt>名称：</dt>
      <dd>
        <input name="title" type="text" value="{$cashcoupon.title}">&nbsp;&nbsp;代金券名称
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>金额：</dt>
      <dd>
      	<input name="amount" type="text" value="{$cashcoupon.amount}">&nbsp;&nbsp;代金券面值金额
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>开始：</dt>
      <dd>
        <input type="text" name="stime" onfocus="rcalendar(this);"
								value="{$cashcoupon['stime']|paramMillisecond2Date}" readonly>&nbsp;&nbsp;代金券开始使用日期
      </dd>
    </dl>
		
    <dl class="lineD">
      <dt>结束：</dt>
      <dd>
        <input type="text" name="etime" onfocus="rcalendar(this);"
								value="{$cashcoupon['etime']|paramMillisecond2Date}" readonly>&nbsp;&nbsp;代金券使用截止日期
      </dd>
    </dl>
    
    <dl class="lineD" style="width:100%">
      <dt>总数：</dt>
      <dd>
      	<input name="total_no" type="text" value="{$cashcoupon.total_no}">&nbsp;&nbsp;生成的代金券总数
      </dd>
    </dl>	      
 	
    
 	<dl class="lineD">
      <dt>类型：</dt>
      <dd>
      	<input id="sortdesc" type="text" value="{$cashcoupon['sort_id']|getCategoryName}" 
      					onclick="ui.box.load(
    											'{:U('Index://Public/showtree',array('code'=>'cashcoupon'))}'
    											,{ title:'查看商户分类' })"
      					readonly>&nbsp;&nbsp;代金券类型
      	<input id="sort_code" name="sort_code" type="hidden" value="{$cashcoupon['sort_code']}">
			<script>
				function _tmp_setselectdict(rel,txt){
			    		$('#sortdesc').val(txt);
			    		$('#sort_code').val(rel);
			    		$('#partnerdesc').val('');$('#partner_id').val(''); 
			    		$('#goodsdesc').val('');$('#goods_id').val(''); 
			    		$('#partnerdesc').unbind('click');
			    		$('#goodsdesc').unbind('click');
			    		if(rel=='cashcoupon_public'){
			    			$('#partnerdesc').click(function(){});
			    			$('#partnerdesc').addClass('_temp_bg');
			    			$('#goodsdesc').click(function(){});
			    			$('#goodsdesc').addClass('_temp_bg');
			    		}
			    		if(rel=='cashcoupon_partner'){
			    			$('#partnerdesc').click(function(){ var callback = $('#partnerdesc').attr('callback');eval(callback); });
			    			$('#partnerdesc').removeClass('_temp_bg');
			    			$('#goodsdesc').click(function(){});
			    			$('#goodsdesc').addClass('_temp_bg');
			    		}
			    		if(rel=='cashcoupon_goods'){
			    			$('#partnerdesc').click(function(){ var callback = $('#partnerdesc').attr('callback');eval(callback); });
			    			$('#partnerdesc').removeClass('_temp_bg');
			    			$('#goodsdesc').click(function(){ 
			    					var pid = $('#partner_id').val(); 
			    					if(pid==null||pid==''){ $('#partnerdesc').click();return; } 
			    					var callback = $('#goodsdesc').attr('callback');eval(callback);
			    			});
			    			$('#goodsdesc').removeClass('_temp_bg');
			    		}
			    }
			</script>
			<style>._temp_bg{background-color:#A4A4A4}</style>
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>最低：</dt>
      <dd>
      	<input name="min_amount" type="text" value="{$cashcoupon.min_amount}">&nbsp;&nbsp;订单最低消费金额
      </dd>
    </dl>	      
    
    
    <dl class="lineD">
      <dt>商户：</dt>
      <dd>
      		<input id="partnerdesc" type="text" value="{:getParnterTitle($cashcoupon['partner_id'])}" class="_temp_bg"
							callback="k_pop_syncSearch('partner_id'
					        													,'partnerdesc'
					        													,'选择商户'
					        													,'{:U('Admin://Partner/getJson')}'
					        													,null
					        													,function(){ $('#goodsdesc').val('');$('#goods_id').val(''); })" 
				readonly >&nbsp;&nbsp;代金券对应的商户
			<input name="partner_id" id="partner_id" type="hidden" value="{$cashcoupon['partner_id']}">
      </dd>
    </dl>
    
    <dl class="lineD">
      <dt>商品：</dt>
      <dd>
      	<input id="goodsdesc" type="text" value="{:getGoodsTitle($cashcoupon['goods_id'])}" class="_temp_bg"
					        callback="k_pop_syncSearch('goods_id'
					        													,'goodsdesc'
					        													,'选择商品'
					        													,'{:U('Admin://Goods/getJson',array('partner_id'=>''))}'+$('#partner_id').val()
					        													,null
					        													,null)" 
					        readonly >&nbsp;&nbsp;代金券对应的商品
		<input name="goods_id" id="goods_id" type="hidden" value="{$cashcoupon['goods_id']}">
      </dd>
    </dl>
   
   	
    <div class="clear"></div>
    <div class="page_btm" style="padding: 18px 0 18px 0;text-align: center;">
      <input type="submit" class="btn_b" value="提交" />
    </div>
    </form>
  </div>
	
</div>
<include file="../Public/_footer.html" />